package com.jiwang.mail.util.result;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 沈伟峰
 */
@Getter
@AllArgsConstructor
public class ResultStatus {

    // 操作成功
    public static final ResultStatus SUCCESS = new ResultStatus(200, "success", "成功");

    // 操作失败
    public static final ResultStatus FAIL = new ResultStatus(400, "fail", "失败");
    public static final ResultStatus UNKNOWN_ERROR = new ResultStatus(401, "unknown error", "未知错误");

    // 6xx 为邮件错误
    public static final ResultStatus MAIL_MISS_INFO = new ResultStatus(601, "missing key information", "邮件缺少关键信息");
    public static final ResultStatus MAIL_PARSE_FAIL = new ResultStatus(602, "failed to parse mail", "邮件解析失败");
    public static final ResultStatus MAIL_SEND_FAIL = new ResultStatus(603, "failed to send mail", "邮件发送失败");
    public static final ResultStatus MAIL_SESSION_FAIL = new ResultStatus(651, "failed to establish session with host", "与服务器建立会话失败");

    private final int code;
    private final String messageEN;
    private final String messageZH;

    public String getMessage() {
        return getMessageZH();
    }
}
